// run: $exec < input
#include <iostream>

int n, k;

int calc(int x)
{
	int ret = 0;
	for (; x; x /= 10)
		ret += ((x % 10 == 4) || (x % 10 == 7));
	return ret;
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> k;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int x;
		std::cin >> x;
		ans += (calc(x) <= k);
	}
	std::cout << ans << '\n';
}

